<template>
	<view class="u-skeleton">
		<view class="bg">
			<view class="padding" style="width: 100%;height: 347px;">
				<image class="" style="width: 100%;height: 100%;border-radius: 30rpx;" :src="order.massageImg"></image>
			</view>

			<view class="padding-lr">
				<view class="margin-right-xs text-df"
					style="width: 400rpx; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">
					{{order.title}}
				</view>
				<view class="text-xs margin-top-sm" style="color: #26C278;">
					<!-- ￥<text class="text-df">{{isVip? order.memberMoney :order.money}}/</text>60分钟 -->
					￥<text class="text-df">{{order.artificerPrice}}/</text>{{order.duration}}分钟
				</view>
			
				<!-- <view class="margin-top-xs ">
					<text class="padding-xs margin-right-xs text-sm" style="color: #26C278;background-color: #FFEBF0;"
						v-for="(item,index) in order.gameName" :key="index">{{item}}</text>
				</view> -->
				<view class="margin-top-sm padding-bottom-sm" style="border-top: 2rpx solid #F5F5F2;">
					<view class="text-bold text-df padding-tb-xs">适用说明</view>
					<view class="text-sm " style="color: #666666;">
						{{order.content}}
					</view>
				</view>
				
				<view class="flex align-center padding-tb-sm " style="border-top: 2rpx solid #F5F5F2;">
					<view class="flex align-center" style="margin-right: 39upx;">
						<image src="../../../static/images/index/renz1.png" style="width: 32upx;height: 28upx;"></image>
						<text class="margin-left-xs">实名认证</text>
					</view>
					<view class="flex align-center" style="margin-right: 39upx;">
						<image src="../../../static/images/index/renz2.png" style="width:28upx;height: 33upx;"></image>
						<text class="margin-left-xs">资质认证</text>
					</view>
					<view class="flex align-center">
						<image src="../../../static/images/index/renz3.png" style="width: 28upx;height: 32upx;"></image>
						<text class="margin-left-xs">平台担保</text>
					</view>
				</view>
			</view>
		</view>

		
		<view class="margin-top-sm bg radius u-skeleton-fillet">
			<view class="text-center padding">服务详情</view>
			<view v-for="(item,index) in order.contentImg" :key="index" style="width: 100%;height: 80vh;">
				<image :src="item" style="width: 100%;height: 100%;"></image>
			</view>

		</view>




		
		<!-- <u-picker v-model="show" mode="time" :params="params" @confirm="statusChange"></u-picker> -->
		<u-skeleton :loading="loading" :animation="true" bgColor="#FFF"></u-skeleton>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				game: [],
				loading: true, // 是否显示骨架屏组件
				customStyle: {
					width: '400upx',
					color: '#FFFFFF',
					background: "#005DFF",
					border: 0
				},
				id: '',
				orderDet: {},
				page: 1,
				limit: 10,
				order: {},
				commentList: [],
				isFollow: false,
				myId: '',
				isVip: false,
				AUDIO: uni.createInnerAudioContext(),
				isPlay: false,
				show: false,
				params: {
					year: false,
					month: true,
					day: true,
					hour: true,
					minute: true,
					second: true,
					timestamp: true
				},
				startTime: '',
				mobile: '',
				name: '',
				cityaddress: '',
				detailaddress: '',
				latitude: '',
				longitude: '',
				province: '',
				city: '',
				district: '',
				age: 0
			}
		},
		onLoad(option) {
			// this.$queue.showLoading("加载中...");
			this.id = option.id
			this.getDet()
			this.getOrderComment()
			this.myId = uni.getStorageSync('userId')
			this.isVip = uni.getStorageSync('isVIP')
			console.log(this.isVip)

		},
		onShow() {

		},
		onReady() {
			this.AUDIO.onEnded(function(res) {
				this.isPlay = false;
			});
		},
		methods: {
			
			bindTophoto(index, id) {
				console.log(index, id)
				if (index == 1) {
					uni.navigateTo({
						url: './detailphoto?id=' + id
					})
				} else if (index == 2) {
					uni.navigateTo({
						url: './workphoto?id=' + id
					})
				}
			},
			// 详情
			getDet() {
				uni.showLoading({
					title: '加载中...'
					
				});
				this.$Request.get("/app/artificer/selectMassageTypeById", {
					massageTypeId: this.id,
				}).then(res => {
					this.loading = false;
					uni.hideLoading();
					if (res.code == 0) {
						this.order = res.data
						// this.order.gameName = this.order.gameName.split(",");
						this.order.contentImg = this.order.contentImg.split(",");
						// this.order.certificateImg = this.order.certificateImg.split(",");
						// this.order.headImg = this.order.headImg.split(",");
						// this.order.workImg = this.order.workImg.split(",");
						// this.selectFollow()
						// if (this.order.region) {
						// 	let region = this.order.region.split(",");
						// 	this.order.region = region[1]
						// } else {
						// 	this.order.region = '不限地区'
						// }
	
						// uni.hideLoading();
					} else {
						// this.loading = false;
						// uni.hideLoading();
					}


				});

			},
			// 评论
			// getOrderComment() {
			// 	this.$Request.get("/app/takingComment/selectOrderTakingComment", {
			// 		id: this.id,
			// 		page: this.page,
			// 		limit: this.limit
			// 	}).then(res => {
			// 		if (res.code == 0) {
			// 			this.commentList = [...this.commentList, ...res.data.list]
			// 		}
			// 	});
			// },
			// 是否关注
			selectFollow() {
				this.$Request.get("/app/userFollow/selectFollowUser", {
					followUserId: this.order.userId
				}).then(res => {
					if (res.data == true) {
						this.isFollow = true
					} else {
						this.isFollow = false
					}

				});
			},
			playVoice() {
				console.log(this.isPlay)
				this.AUDIO.src = this.order.voiceIntroduce;
				if (this.isPlay) {
					this.AUDIO.stop();
				} else {
					this.AUDIO.play();
				}
				this.isPlay = !this.isPlay;
			},
			goNav() {
				// if (this.startTime == '') {
				// 	uni.showToast({
				// 		icon: 'none',
				// 		title: '请选择上门时间'
				// 	});
				// 	return;
				// }
				uni.navigateTo({
					url: "/pages/index/game/orderDet?id=" + this.id
				})
			},
			goMsg() {
				let data = {
					userId: this.myId,
					focusedUserId: this.order.userId
				}
				this.$Request.postJson('/app/chat/insertChatConversation ', data).then(res => {
					if (res.code == 0) {
						let id = this.order.userId == res.data.userId ? res.data.focusedUserId : this.order.userId
						uni.navigateTo({
							url: '/pages/msg/im?chatConversationId=' + res.data.chatConversationId +
								'&byUserId=' + id
						})
					}
				})
			},
			// 关注
			follow() {
				let that = this
				that.$Request.get("/app/userFollow/insert", {
					followUserId: that.order.userId
				}).then(res => {
					uni.showToast({
						title: res.msg,
						icon: 'none'
					})
					setTimeout(function() {
						that.selectFollow()
					}, 500)
				});
			}
		}

	}
</script>

<style>
	page {
		background-color: #F7F7F7;
	}

	.bgs {
		background-color: #FFFFFF;
	}

	.bg {
		background-color: #FFFFFF;
	}

	.line_s {
		display: inline-flex;
		width: 14rpx;
		height: 14rpx;
		background: #1AD566;
		border-radius: 50%;
		margin-right: 10rpx;
	}

	.line_x {
		display: inline-flex;
		width: 14rpx;
		height: 14rpx;
		background: #000000;
		border-radius: 50%;
		margin-right: 10rpx;
	}
</style>
